package com.bw.activity7.activiti.service;


import com.bw.activity7.activiti.pojo.ActivitiVo;
import com.bw.activity7.activiti.pojo.UserTask;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.runtime.ProcessInstance;

import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public interface ActivitiService {
    /**
     * 1流程部署
     * @param name 流程名称：请假流程
     * @param deploymentKey 部署的Key：ASK_FOR_LEAVE_ACT
     * @param bmpResourceName bmp文件，ressource相对位置：bpm/askForLeaveBpm.bpmn
     */
    void createDeployment(String name,String deploymentKey,String bmpResourceName);

    /**
     * 2启动工作流
     * @param activitiVo
     * deploymentKey 流程部署的key
     * List<Variable> variables 流程变量，多个key、value
     * username当前登录用户名称
     * businessKey 业务id，不如请假、合同的id等
     *
     */
    ProcessInstance askForBiz(ActivitiVo activitiVo);


    /**
     * 3我的待办
     * @param activitiVo
     * username 用户名称
     * @return
     */
    List<UserTask> queryUserTaskByUserName(ActivitiVo activitiVo);


    /**
     * 4审核
     * @param activitiVo
     * taskId，接口三中，获取该参数
     * username 用户名称
     * auditFlag 通过/拒绝
     * message 审核一键
     */
    void completeUserTaskById(ActivitiVo activitiVo);

    /**
     * 5根据流程实例Id，查看流程进度
     * @param processInstanceId 2中的businessKey对应
     * @param outputStream response的getOutStream
     */
    void getFlowImgByInstanceId(String processInstanceId, OutputStream outputStream);


    ArrayList<Map> getHistoricProcessInstance(ActivitiVo activitiVo);


    /**
     * 根据Id，查询历史流程Id
     * @param activitiVo
     * @return
     */
    public HistoricProcessInstance getHistoricProcessInstanceById(ActivitiVo activitiVo);
}
